import request from "@/netword/request";


const fun = {};


// 分页查询所有信息
fun.getList = async (notice) => {
    const res = await request({
        url: "/a/content/notice/list",
        method: "post",
        params: {
            noticeTitle: notice.noticeTitle,
            pageNo: notice.pageNo,
            pageSize: notice.pageSize,
        }
    })
    return res.data;
}



//保存数据
fun.saveNotice = async (notice) => {
    const res = await request({
        url: "/a/content/notice/save",
        method: "put",
        params: {
            noticeTitle: notice.noticeTitle,
            noticeContent: notice.noticeContent,
            sort:notice.sort,
        }
    })
    return res.data;
}



//更新数据
fun.updateNotice = async (notice) => {
    const res = await request({
        url: "/a/content/notice/update",
        method: "post",
        params: {
            id: notice.id,
            noticeTitle: notice.noticeTitle,
            noticeContent: notice.noticeContent,
            sort:notice.sort,
        }
    })
    return res.data;
}



//修改数据状态（正常，停用，删除）
fun.saveStatus = async (id,status) => {
    const res = await request({
        url: "/a/content/notice/updateStatus",
        method: "post",
        params: {
            id: id,
            status:status
        }
    })
    return res.data;
}


//查询单条数据
fun.getNotice = async (id) => {
    const res = await request({
        url: "/a/content/notice/get",
        method: "get",
        params: {
            id: id
        }
    })
    return res.data;
}


export default fun;